package cn.iocoder.yudao.module.erp.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @projectName: ruoyi-p
 * @package: cn.iocoder.yudao.module.erp.controller.admin
 * @className: DemoTestController
 * @author: Maxuxu
 * @description: TODO
 * @date: 2023/11/26 13:17
 * @version: 1.0
 */
@Tag(name = "用户 App - Test")
@RestController
@RequestMapping("/erp/test")
@Validated
@Slf4j
public class DemoTestController {
    @Resource
    private ErpNoRedisDAO noRedisDAO;
    @GetMapping("/get-no")
    public CommonResult<String> getNo() {
        String generate = noRedisDAO.generate(ErpNoRedisDAO.STOCK_IN_NO_PREFIX);
        return CommonResult.success(generate);
    }

    @GetMapping("/hello")
    public CommonResult<String> hello() {
        log.error("hello");
//        for (int i = 0; i < 10; i++) {
//            Object next = sequence.nextStr();
//            Object next1 = sequence.next();
//            Optional optional = sequence.nextOpt();
//            Optional optional1 = sequence.nextStrOpt();
//            String name = sequence.getName();
//            log.info("当前第{}的值是：{}，next is {},nextopt is {}, nextstropt is {}",i, next,next1,optional,optional1);
//        }
//        List<String> list = new ArrayList<>(10);
//        for (int i = 0; i < 10; ++i) {
//            list.add(sequence.nextStr());
//        }
//        Map<String, Object> data = new HashMap<>();
//        data.put("query_count", Long.toString(seqSynchronizer.getQueryCounter()));
//        data.put("update_count", Long.toString(seqSynchronizer.getUpdateCounter()));
//        data.put("seq", list);
//        log.info("list is {}",data);
//        ArrayList<String> list = new ArrayList<>();
        return CommonResult.success("trest");
    }
}